/*
 * Project: Generic Project DAO Exceptions
 * Package: net.made2ordersoftware.service.exceptions
 * File:    IllegalOrphanException
 * Created: May 22, 2010
 */
/**
 * Copyright (c) 2010 Made 2 Order Software, LLC
 *
 * All rights reserved. No part of this software may be reproduced, stored in a retrieval system, or transmitted in any
 * form or by any means, without the prior written permission of Made 2 Order Software.
 *
 * You may not distribute the URL or redistribute the files to third parties. You may transfer the files onto a single
 * storage device so long as you can prove ownership of the software. You may not reverse engineer, decompile, or
 * disassemble the software or media files. You may not modify or translate the software or media, or distribute copies
 * of the software or media without the written consent of Made 2 Order Software, LLC.
 */
package com.made2ordersoftware.service.exceptions;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 *
 * @author David Canning <dcannin@gmail.com>
 * @version 1.0.0
 */
public class IllegalOrphanException extends Exception {

    private static final long serialVersionUID = 1L;

    private final List<String> messages;

    /**
     * Creates an instance of <code>NonexistentEntityException</code> with a list of messages.
     *
     * @param messages
     */
    public IllegalOrphanException(List<String> messages) {
        super((messages != null && messages.size() > 0 ? messages.get(0) : null));
        if (messages == null) {
            this.messages = new ArrayList<>();
        } else {
            this.messages = messages;
        }
    }

    /**
     * Returns the list of messages for this exception
     *
     * @return the list of messages
     */
    public List<String> getMessages() {
        return Collections.unmodifiableList(messages);
    }
}
